package tojson

func Success(data any) map[string]any {
	body := make(map[string]any)
	body["status"] = 200
	body["message"] = "操作成功"
	body["body"] = data
	return body
}
func Error(err error) map[string]any {
	body := make(map[string]any)
	body["status"] = 209
	body["message"] = err.Error()
	return body
}

func NoAuth(message string) map[string]any {
	if message == "" {
		message = "未授权"
	}
	body := make(map[string]any)
	body["status"] = 401
	body["message"] = message
	return body
}

func ErrorCode(code int, message string) map[string]any {
	body := make(map[string]any)
	body["status"] = code
	body["message"] = message
	return body
}
